package com.xpxrule.strategy.operator;

import com.xpxrule.constant.FieldType;
import com.xpxrule.constant.ValueType;
import com.xpxrule.dataobject.base.Range;
import com.xpxrule.dataobject.bo.RuleConditionItemBo;
import com.xpxrule.strategy.field.FieldTypeStrategy;

import java.util.List;
import java.util.Map;

public class NullOperatorStrategy extends OperatorStrategy{

    @Override
    String getAviatorExpressionByCollectionValue(String fieldKey, List<Object> listValue, RuleConditionItemBo conditionItemBo, Map<String, Object> params, FieldTypeStrategy fieldTypeStrategy, FieldType fieldType) {
        return null;
    }

    @Override
    String getAviatorExpressionByRangeValue(String fieldKey, Range<Object> rangeValue, RuleConditionItemBo conditionItemBo, Map<String, Object> params, FieldTypeStrategy fieldTypeStrategy, FieldType fieldType) {
        return null;
    }

    @Override
    String getAviatorExpressionBySingleValue(String fieldKey, Object left, Object right, FieldType fieldType) {
        return String.format("%s == nil || string.length(%s) == 0", fieldKey, fieldKey);
    }

    @Override
    protected String getSingleRightValue(FieldTypeStrategy fieldTypeStrategy, Object singleValue) {
        return null;
    }
}
